package com.matt.foundation.vo.course;

import com.matt.foundation.DO.ChildrenCourseItemDO;
import com.matt.foundation.DO.course.CoursePlanClassesDO;
import lombok.Data;

import javax.persistence.Column;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/9/11
 * *******************************
 */
@Data
public class PadTeacherCoursePlanListVo {

    private String planId; //教学计划ID 不需要

    private String courseName; //教学名称 不需要

    private Integer courseType; //早教 托育 类型

    private String typeName;    //类型名称

    private Date courseDate;    //上课日期

    private Date beginTime; //开始时间

    private Date endTime;   //结束时间

    private Integer prepareStatus; //备课状态 不需要

    private Integer courseStatus; //上课状态

    private String classesName; //班级名称

    private Integer templateType; //模板类型 不需要

    private Integer category ; //课程类型
    
    private Integer type;//康轩课程  不要

    private List<PadChildrenStatusListsVo> childrenNameList;  //上课宝宝列表

    private Integer typeCode; //不需要

    private String resObj;//如果是主题课程则存放主题课程ID,否则可能存放资源地址

    public static PadTeacherCoursePlanListVo of(CoursePlanClassesDO coursePlan, List<ChildrenCourseItemDO> itemList) {
        PadTeacherCoursePlanListVo vo = new PadTeacherCoursePlanListVo();
        vo.setPlanId(coursePlan.getClassesCoursePlanId());
        vo.setCourseType(coursePlan.getCourseType());
        vo.setCourseName(coursePlan.getCourseName());
        vo.setCourseStatus(coursePlan.getCourseStatus());
        vo.setTypeName(coursePlan.getTypeName());
        vo.setClassesName(coursePlan.getClassesName());
        vo.setCourseDate(coursePlan.getCourseDate());
        vo.setBeginTime(coursePlan.getBeginTime());
        vo.setEndTime(coursePlan.getEndTime());
        vo.setTemplateType(coursePlan.getTemplateType());
        vo.setPrepareStatus(coursePlan.getPrepareStatus());
        vo.setCategory(coursePlan.getCategory());
        List<PadChildrenStatusListsVo> childrenNameList = itemList.stream().map(o -> PadChildrenStatusListsVo.of(o)).collect(Collectors.toList());
        vo.setChildrenNameList(childrenNameList);
        vo.setTypeCode(coursePlan.getTypeCode());
        vo.setType(coursePlan.getType());
        return vo;
    }


}
